# #Lagos download script
LAGOSNE::lagosne_get(dest_folder = LAGOSNE:::lagos_path())
#Load in lagos
lagos <- lagosne_load()
#Grab the lake centroid info
lake_centers <- lagos$locus
#Look at the column names
#names(lake_centers)
#Look at the structure
#str(lake_centers)
#View the full dataset
#View(lake_centers %>% slice(1:100))
spatial_lakes <- st_as_sf(lake_centers,coords=c('nhd_long','nhd_lat'),
crs=4326) %>%
st_transform(2163)
#Subset for plotting
subset_spatial <- spatial_lakes %>%
slice(1:100)
subset_baser <- spatial_lakes[1:100,]
#Dynamic mapviewer
mapview(subset_spatial)
states <- us_states()
#Plot all the states to check if they loaded
#mapview(states)
minnesota <- states %>%
filter(name == 'Minnesota') %>%
st_transform(2163)
#Subset lakes based on spatial position
minnesota_lakes <- spatial_lakes[minnesota,]
#Plotting the first 1000 lakes
minnesota_lakes %>%
arrange(-lake_area_ha) %>%
slice(1:1000) %>%
mapview(.,zcol = 'lake_area_ha')
#Subset to Iowa
Iowa <- states %>%
filter(name == 'Iowa') %>%
st_transform(2163)
#Subset to Illinois
Illinois <- states %>%
filter(name == 'Illinois') %>%
st_transform(2163)
#Combine both dataframes
Iowa_and_Illinois <- combine(Iowa,Illinois)
mapview(Iowa_and_Illinois)
#Subset lakes based on spatial position
Iowa_and_Illinois_lakes <- spatial_lakes[Iowa_and_Illinois,]
There are fewer lake sites in Illinois and Iowa combined compared to Minnesota. Iowa and Illinois have a combined 16466 observations, while Minnesota alone has 29038 observations.
#Subset just Iowa
Iowa__lakes <- spatial_lakes[Iowa,]
#Create Iowa Histogram
ggplot(data=Iowa__lakes,aes(x=lake_area_ha)) +
geom_histogram() +
scale_x_log10() +
xlab('Log Scale - Iowa Lake Area (ha)')
#Create Minnesota Histogram
ggplot(data=minnesota_lakes,aes(x=lake_area_ha)) +
geom_histogram() +
scale_x_log10() +
xlab('Log Scale - Minnesota Lake Area (ha)')
Although small lakes dominate both states, Minnesota has more larger lakes compared to Iowa.
#Plotting the first 1000 lakes
Iowa_and_Illinois_lakes %>%
arrange(-lake_area_ha) %>%
slice(1:1000) %>%
mapview(.,zcol = 'lake_area_ha')
Mapping groundwater wells by water level could illustrate whether there’s a relationship between groundwater and reservoir/lake size. Additionally, precipitation collection sites for both rain and snow could be compared to determine whether a relationship exists for reservoir/lake size.